from pydantic import BaseModel
from typing import Union


class AOILotItem(BaseModel):
    page_index: int
    page_size: int
    lot_name: Union[str, None] = None


class PMILotItem(BaseModel):
    device_code: str
    page_index: int
    page_size: int
    lot_name: Union[str, None] = None


class WaferMapItem(BaseModel):
    wafer_code: str


class WaferMapsItem(BaseModel):
    lot_code: str
    page_index: int
    page_size: int
    failure: Union[list, None] = None


class WaferStackItem(BaseModel):
    wafer_codes: list
    failure: int


class WaferDieStackItem(BaseModel):
    wafer_codes: list
    failure: int
    row: int
    col: int
    die_dim: int


class DieStackItem(BaseModel):
    wafer_code: str
    failures: list


class AOILotNGItem(BaseModel):
    lot_code: str
    page_index: int
    ng_page_index: int
    page_size: int
    failures: Union[list, None] = None


class AOIWaferNGItem(BaseModel):
    wafer_code: str
    page_index: int
    ng_page_index: Union[int, None] = None
    page_size: int
    failures: Union[list, None] = None


class PMIWaferNGItem(BaseModel):
    wafer_code: str
    page_index: int
    ng_page_index: Union[int, None] = None
    page_size: int


class PMILotNGItem(BaseModel):
    lot_code: str
    page_index: int
    ng_page_index: int
    page_size: int
    keyword: Union[str, None] = None


class PMIProductListItem(BaseModel):
    page_index: Union[int, None] = None
    page_size: Union[int, None] = None


class PMIProductDeleteItem(BaseModel):
    product_code: str


class PMIProductItem(BaseModel):
    product_code: Union[str, None] = None
    product_name: str
    distance: float
    set_num_zhenhen: int
    set_diagonal_length: int
    set_area: int
    set_per_area: float


class LotReportItem(BaseModel):
    lot_code: str


class AOILotInferItem(BaseModel):
    lot_folder: str
    distance: float
    set_num_zhenhen: int
    set_diagonal_length: int
    set_area: int
    set_per_area: float
    area_scale: int


class AOIWaferInferItem(BaseModel):
    distance: float
    set_num_zhenhen: int
    set_diagonal_length: int
    set_area: int
    set_per_area: float
    area_scale: int


class PMILotInferItem(BaseModel):
    device_id: str
    distance: float
    set_per_area: float
    area_scale: int
